<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
           // 1. Array.from - 生成n项的数组，如果不做处理默认每一项是undefined
        const arr= Array.from({ length:5 }).map(()=>{
            const obj={}
            return obj
        })
        // console.log('arr',arr)
        
     // 2. for...of 遍历可迭代的对象 目前大家只要记住forof数组可以用，对象不能用
        const arr1=[1,2,3]
        const arr2=[{a:1,b:2},{a:3,b:4}]
        const arr3=[[6,7],[9,10]]
        for(const{a,b}of arr2){
            console.log(a,b)
        }
        for(const [aaa,bbb]of arr3){
            console.log(aaa,bbb)  
        }
        // 3. Object.entries
        const obj={a:1,b:2}
        const keys=Object.keys(obj)
        // console.log(keys)
        const values=Object.values(obj)
        // console.log(values)
        const entries=  Object.entries(obj)
        // console.log(entries)
        for(let key in obj){
            console.log(key,obj[key])   
        }
        for(const [key,value]of entries){
            console.log(key,value) 
        }
        
    </script>
</body>
</html>